Skip to content

Commit

Permalink
add dom parser docs
Browse files Browse the repository at this point in the history
  • Loading branch information
DerGoogler committed Jun 22, 2024
1 parent a89c848 commit 60e4ace
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions docs/ModConf/functions/DOMParser.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# DOMParser

## Usage

```js
import React from "react";
import { Page } from "@mmrl/ui";
import { List, ListItem, ListItemText } from "@mui/material";

const dom = new DOMParser();

const configStore = dom.parseFromFile(
"/data/misc/apexdata/com.android.wifi/WifiConfigStoreSoftAp.xml"
);

const softap = configStore.getElementsByTagName("SoftAp")[0];

const ssidName = softap
.querySelector('string[name="WifiSsid"]')
.innerHTML.replace(/"(.+)"/g, "$1");
const passwd = softap.querySelector('string[name="Passphrase"]').innerHTML;

export default () => {
return (
<Page>
<List>
<ListItem>
<ListItemText primary="Name" secondary={ssidName} />
</ListItem>
<ListItem>
<ListItemText primary="Password" secondary={passwd} />
</ListItem>
</List>
</Page>
);
};
```

0 comments on commit 60e4ace

Please sign in to comment.