Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse each record into unformatted xml #3

Closed
nitrocode opened this issue Dec 21, 2018 · 2 comments
Closed

Parse each record into unformatted xml #3

nitrocode opened this issue Dec 21, 2018 · 2 comments

Comments

@nitrocode
Copy link

nitrocode commented Dec 21, 2018

It would be nice to remove the formatting for each record so you can iterate over each record

xmlcutty -path /CheatTable/CheatEntries/CheatEntry FIFA.CT | \
  while read record; do echo $record; done;

At the moment the above returns all the records in a pretty format making it difficult to parse individual records.

xmlcutty -unformatted -path /CheatTable/CheatEntries/CheatEntry FIFA.CT | \
  while read record; do echo $record; done;
@miku
Copy link
Owner

miku commented Dec 21, 2018

Ok, this might be easier than #2. I just added a way to specify multiple newlines (or any character) in -rename which might help to distinguish records. It's wrapped up in 0.1.5, hope it's somehow useful.

Searching for a minute, with something like Split file based on string delimiter in bash.how? it might be possible to solve #2 as well. If it works, you can post you solution as reference and close the issues (if you want :).

@miku
Copy link
Owner

miku commented Dec 21, 2018

There is also a --noblanks flag on xmllint, which might be helpful:

$ xmllint --noblanks FIFA.CT | xmlcutty -path /CheatTable/CheatEntries/CheatEntry -rename "\n\n"
...
<ID>839</ID><Description>"------------------------"</Description><LastState Value="" RealAddress="00000000"/><GroupHeader>1</GroupHeader>                                

<ID>263</ID><Description>"Discord: https://discord.gg/cbQePsR"</Description><Options moHideChildren="1"/><LastState Value="" RealAddress="00000000"/><Color>0000FF</Color><GroupHeader>1</GroupHeader>

<ID>1999</ID><Description>"------------------------"</Description><LastState Value="" RealAddress="00000000"/><GroupHeadhttp://xmlsoft.org/xmllint.htmler>1</GroupHeader>                               

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants