renggli / dart-xml Goto Github PK
View Code? Open in Web Editor NEWLightweight library for parsing, traversing, and transforming XML in Dart.
Home Page: http://pub.dartlang.org/packages/xml
License: MIT License
Lightweight library for parsing, traversing, and transforming XML in Dart.
Home Page: http://pub.dartlang.org/packages/xml
License: MIT License
I really appreciate the work you've done on this library, and I'm happy to see the SAX based interface.
I'm interested in a .NET style XmlReader interface, where, instead of callbacks on events, you tell the reader when you're ready to continue. I have some ideas around implementing this based on your SAX interface. Would you be interested in including such a thing here?
for example:
<test>
a + b > c;
d + e < f;
</test>
xml fail to parse such text
Hi Rengli,
I just tried to build and xml file and I had to change a variable name from the example.
it's probably related to that little code we changed at the end of last week; that import namespace.
builder.element('price', nest: 39.95); }); builder.element('price', nest: 132.00); }); var xml = builder.build();
so i just changed the name of the var xml to xmlPrint
and then just called print.
builder.element('price', nest: 132.00); }); var xml1 = builder.build(); //have to change xml to anything otherwise, because of xml.xmlBuilder, gives 'Local variables cannot be referenced before they are declared' print(xml1.toString());
I need help with dart and xml but I'll throw it open to the general stackoverflow questions later as I want to learn some other mistakes i'm making with dart:io.
later,
Hey, I'm receiving an XML with multiple items, each slightly different. I am grabbing the name from each and building a list for the user to select from. But the list generates in a random order each time making it so that I can't use the index. Is there another way of doing this?
So if i run:
doc.findAllElements.elementAt(0);
I get different responses, and I would like to get the same item everytime.
I have used this lib to make a simple BFS of a xml tree.
import 'package:xml/xml.dart' as xml;
void bfsTree(xml.XmlDocument node, callback) {
final stack = [];
stack.add(node);
var index = 0;
while(stack.isNotEmpty) {
index += 1;
final xml.XmlNode popped = stack.removeLast();
callback(popped.toString(), index);
if (popped.children.isNotEmpty) {
stack.addAll(popped.children);
}
}
}
void main() {
final String bookshelfXml = '''<bookshelf>
<book>
<title lang="english">Growing a Language</title>
<price>29.99</price>
</book>
<book>
<title lang="english">Learning XML</title>
<price>39.95</price>
</book>
<price>132.00</price>
</bookshelf>''';
final xml.XmlDocument document = xml.parse(bookshelfXml.trim());
bfsTree(
document,
(resultString, index) { print('travse number $index this $resultString'); },
);
}
I have tried to print out the name of every node I have traversed, then I realized that I have no way to access a XmlNode's node name except turning the node into a string and extract the name from it.
Would you pleased add an nodeName
property to the XmlNode class ? For those anonymous nodes like the Text node, you can simply assign something like AnonymousText
to it.
The issue seems to be the xml library. If I use the xml library or another lib that depends on the xml library it just hangs forever.
#51158 Steps to Reproduce
Expected results: Output showing the app is being built and then launching in the emulator
Actual results:
[ +3 ms] executing: [/home/kannalo/AndroidStudioProjects/lolisnatcher_droid/android/] /home/kannalo/AndroidStudioProjects/lolisnatcher_droid/android/gradlew
-Pverbose=true -Ptarget=/home/kannalo/AndroidStudioProjects/lolisnatcher_droid/lib/main.dart -Ptrack-widget-creation=true -Pfilesystem-scheme=org-dartlang-root
-Ptarget-platform=android-x86 assembleDebug
[kannalo@loliBox lolisnatcher_droid]$ ~/Android/flutter/bin/flutter run --verbose
[ +21 ms] executing: [/home/kannalo/Android/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +31 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[ ] 0b8abb4724aa590dd0f429683339b1e045a1594d
[ ] executing: [/home/kannalo/Android/flutter/] git describe --match v*.*.* --first-parent --long --tags
[ +8 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[ ] v1.12.13+hotfix.8-0-g0b8abb472
[ +6 ms] executing: [/home/kannalo/Android/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[ +6 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ ] origin/stable
[ ] executing: [/home/kannalo/Android/flutter/] git ls-remote --get-url origin
[ +7 ms] Exit code 0 from: git ls-remote --get-url origin
[ ] https://github.com/flutter/flutter.git
[ +41 ms] executing: [/home/kannalo/Android/flutter/] git rev-parse --abbrev-ref HEAD
[ +10 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ ] stable
[ +78 ms] executing: /home/kannalo/Android/Sdk/platform-tools/adb devices -l
[ +12 ms] Exit code 0 from: /home/kannalo/Android/Sdk/platform-tools/adb devices -l
[ ] List of devices attached
emulator-5554 device product:sdk_gphone_x86 model:Android_SDK_built_for_x86 device:generic_x86 transport_id:2
[ +19 ms] /home/kannalo/Android/Sdk/platform-tools/adb -s emulator-5554 shell getprop
[ +47 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[ +2 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +8 ms] Running "flutter pub get" in lolisnatcher_droid...
[ +4 ms] executing: [/home/kannalo/AndroidStudioProjects/lolisnatcher_droid/] /home/kannalo/Android/flutter/bin/cache/dart-sdk/bin/pub --verbose get --no-precompile
[ +116 ms] FINE: Pub 2.7.0
[ +78 ms] MSG : Resolving dependencies...
[ +6 ms] SLVR: fact: lolisnatcher_droid is 1.0.0+1
[ +3 ms] SLVR: derived: lolisnatcher_droid
[ +16 ms] SLVR: fact: lolisnatcher_droid depends on flutter any from sdk
[ ] SLVR: fact: lolisnatcher_droid depends on cupertino_icons ^0.1.2
[ ] SLVR: fact: lolisnatcher_droid depends on http ^0.12.0+4
[ ] SLVR: fact: lolisnatcher_droid depends on xml2json ^4.1.1
[ +181 ms] MSG : Got dependencies!
[ +27 ms] SLVR: fact: lolisnatcher_droid depends on xml ^3.5.0
[ ] SLVR: fact: lolisnatcher_droid depends on flutter_test any from sdk
[ ] SLVR: selecting lolisnatcher_droid
[ ] SLVR: derived: flutter_test any from sdk
[ ] SLVR: derived: xml ^3.5.0
[ ] SLVR: derived: xml2json ^4.1.1
[ ] SLVR: derived: http ^0.12.0+4
[ ] SLVR: derived: cupertino_icons ^0.1.2
[ ] SLVR: derived: flutter any from sdk
[ ] SLVR: fact: flutter_test 0.0.0 from sdk depends on flutter any from sdk
[ ] SLVR: fact: flutter_test 0.0.0 from sdk depends on test_api 0.2.11
[ ] SLVR: fact: flutter_test 0.0.0 from sdk depends on path 1.6.4
[ ] SLVR: fact: flutter_test 0.0.0 from sdk depends on image 2.1.4
[ ] SLVR: fact: flutter_test 0.0.0 from sdk depends on quiver 2.0.5
[ ] SLVR: fact: flutter_test 0.0.0 from sdk depends on stack_trace 1.9.3
[ ] SLVR: fact: flutter_test 0.0.0 from sdk depends on vector_math 2.0.8
[ ] SLVR: fact: flutter_test 0.0.0 from sdk depends on archive 2.0.11
[ ] SLVR: fact: flutter_test 0.0.0 from sdk depends on args 1.5.2
[ ] SLVR: fact: flutter_test 0.0.0 from sdk depends on async 2.4.0
[ ] SLVR: fact: flutter_test 0.0.0 from sdk depends on boolean_selector 1.0.5
[ ] SLVR: fact: flutter_test 0.0.0 from sdk depends on charcode 1.1.2
[ ] SLVR: fact: flutter_test 0.0.0 from sdk depends on collection 1.14.11
[ ] SLVR: fact: flutter_test 0.0.0 from sdk depends on convert 2.1.1
[ ] SLVR: fact: flutter_test 0.0.0 from sdk depends on crypto 2.1.3
[ ] SLVR: fact: flutter_test 0.0.0 from sdk depends on matcher 0.12.6
[ ] SLVR: fact: flutter_test 0.0.0 from sdk depends on meta 1.1.8
[ ] SLVR: fact: flutter_test 0.0.0 from sdk depends on pedantic 1.8.0+1
[ ] SLVR: fact: flutter_test 0.0.0 from sdk depends on petitparser 2.4.0
[ ] SLVR: fact: flutter_test 0.0.0 from sdk depends on source_span 1.5.5
[ ] SLVR: fact: flutter_test 0.0.0 from sdk depends on stream_channel 2.0.0
[ ] SLVR: fact: flutter_test 0.0.0 from sdk depends on string_scanner 1.0.5
[ ] SLVR: fact: flutter_test 0.0.0 from sdk depends on term_glyph 1.1.0
[ ] SLVR: fact: flutter_test 0.0.0 from sdk depends on typed_data 1.1.6
[ ] SLVR: fact: flutter_test 0.0.0 from sdk depends on xml 3.5.0
[ ] SLVR: selecting flutter_test 0.0.0 from sdk
[ ] SLVR: derived: xml 3.5.0
[ ] SLVR: derived: typed_data 1.1.6
[ ] SLVR: derived: term_glyph 1.1.0
[ ] SLVR: derived: string_scanner 1.0.5
[ ] SLVR: derived: stream_channel 2.0.0
[ ] SLVR: derived: source_span 1.5.5
[ ] SLVR: derived: petitparser 2.4.0
[ ] SLVR: derived: pedantic 1.8.0+1
[ ] SLVR: derived: meta 1.1.8
[ ] SLVR: derived: matcher 0.12.6
[ ] SLVR: derived: crypto 2.1.3
[ ] SLVR: derived: convert 2.1.1
[ ] SLVR: derived: collection 1.14.11
[ ] SLVR: derived: charcode 1.1.2
[ ] SLVR: derived: boolean_selector 1.0.5
[ ] SLVR: derived: async 2.4.0
[ ] SLVR: derived: args 1.5.2
[ ] SLVR: derived: archive 2.0.11
[ ] SLVR: derived: vector_math 2.0.8
[ ] SLVR: derived: stack_trace 1.9.3
[ ] SLVR: derived: quiver 2.0.5
[ ] SLVR: derived: image 2.1.4
[ ] SLVR: derived: path 1.6.4
[ ] SLVR: derived: test_api 0.2.11
[ ] SLVR: fact: xml 3.5.0 depends on petitparser ^2.3.0
[ ] SLVR: fact: xml 3.5.0 depends on collection ^1.14.0
[ ] SLVR: fact: xml 3.5.0 depends on convert ^2.1.0
[ ] SLVR: selecting xml 3.5.0
[ ] SLVR: fact: xml2json 4.1.1 depends on xml ^3.0.0
[ ] SLVR: selecting xml2json 4.1.1
[ ] SLVR: fact: http 0.12.0+4 depends on async >=1.10.0 <3.0.0
[ ] SLVR: fact: http 0.12.0+4 depends on http_parser >=0.0.1 <4.0.0
[ ] SLVR: fact: http 0.12.0+4 depends on path >=0.9.0 <2.0.0
[ ] SLVR: fact: http 0.12.0+4 depends on pedantic ^1.0.0
[ ] SLVR: selecting http 0.12.0+4
[ ] SLVR: derived: http_parser >=0.0.1 <4.0.0
[ ] SLVR: selecting cupertino_icons 0.1.3
[ ] SLVR: fact: flutter 0.0.0 from sdk depends on collection 1.14.11
[ ] SLVR: fact: flutter 0.0.0 from sdk depends on meta 1.1.8
[ ] SLVR: fact: flutter 0.0.0 from sdk depends on typed_data 1.1.6
[ ] SLVR: fact: flutter 0.0.0 from sdk depends on vector_math 2.0.8
[ ] SLVR: fact: flutter 0.0.0 from sdk depends on sky_engine any from sdk
[ ] SLVR: selecting flutter 0.0.0 from sdk
[ ] SLVR: derived: sky_engine any from sdk
[ ] SLVR: selecting typed_data 1.1.6
[ ] SLVR: selecting term_glyph 1.1.0
[ ] SLVR: fact: string_scanner 1.0.5 depends on charcode ^1.1.0
[ ] SLVR: fact: string_scanner 1.0.5 depends on meta ^1.1.0
[ ] SLVR: fact: string_scanner 1.0.5 depends on source_span ^1.4.0
[ ] SLVR: selecting string_scanner 1.0.5
[ ] SLVR: fact: stream_channel 2.0.0 depends on async >=1.11.0 <3.0.0
[ ] SLVR: selecting stream_channel 2.0.0
[ ] SLVR: fact: source_span 1.5.5 depends on charcode ^1.0.0
[ ] SLVR: fact: source_span 1.5.5 depends on path ^1.2.0
[ ] SLVR: fact: source_span 1.5.5 depends on term_glyph ^1.0.0
[ ] SLVR: selecting source_span 1.5.5
[ ] SLVR: fact: petitparser 2.4.0 depends on meta ^1.1.0
[ ] SLVR: selecting petitparser 2.4.0
[ ] SLVR: selecting pedantic 1.8.0+1
[ ] SLVR: selecting meta 1.1.8
[ ] SLVR: fact: matcher 0.12.6 depends on stack_trace ^1.2.0
[ ] SLVR: selecting matcher 0.12.6
[ ] SLVR: fact: crypto 2.1.3 depends on collection ^1.0.0
[ ] SLVR: fact: crypto 2.1.3 depends on convert >=1.0.0 <3.0.0
[ ] SLVR: fact: crypto 2.1.3 depends on typed_data ^1.0.0
[ ] SLVR: selecting crypto 2.1.3
[ ] SLVR: fact: convert 2.1.1 depends on charcode ^1.1.0
[ ] SLVR: fact: convert 2.1.1 depends on typed_data ^1.1.0
[ ] SLVR: selecting convert 2.1.1
[ ] SLVR: selecting collection 1.14.11
[ ] SLVR: selecting charcode 1.1.2
[ ] SLVR: fact: boolean_selector 1.0.5 depends on source_span ^1.0.0
[ ] SLVR: fact: boolean_selector 1.0.5 depends on string_scanner >=0.1.1 <2.0.0
[ ] SLVR: selecting boolean_selector 1.0.5
[ ] SLVR: fact: async 2.4.0 depends on collection ^1.5.0
[ ] SLVR: selecting async 2.4.0
[ ] SLVR: selecting args 1.5.2
[ ] SLVR: fact: archive 2.0.11 depends on crypto ^2.0.0
[ ] SLVR: fact: archive 2.0.11 depends on args ^1.4.0
[ ] SLVR: fact: archive 2.0.11 depends on path ^1.5.1
[ ] SLVR: selecting archive 2.0.11
[ ] SLVR: selecting vector_math 2.0.8
[ ] SLVR: fact: stack_trace 1.9.3 depends on path ^1.2.0
[ ] SLVR: selecting stack_trace 1.9.3
[ ] SLVR: fact: quiver 2.0.5 depends on matcher >=0.10.0 <0.13.0
[ ] SLVR: fact: quiver 2.0.5 depends on meta ^1.0.0
[ ] SLVR: selecting quiver 2.0.5
[ ] SLVR: fact: image 2.1.4 depends on archive >=1.0.16 <3.0.0
[ ] SLVR: fact: image 2.1.4 depends on xml ^3.2.5
[ ] SLVR: selecting image 2.1.4
[ ] SLVR: selecting path 1.6.4
[ ] SLVR: fact: test_api 0.2.11 depends on async ^2.0.0
[ ] SLVR: fact: test_api 0.2.11 depends on boolean_selector ^1.0.0
[ ] SLVR: fact: test_api 0.2.11 depends on collection ^1.8.0
[ ] SLVR: fact: test_api 0.2.11 depends on meta ^1.1.5
[ ] SLVR: fact: test_api 0.2.11 depends on path ^1.2.0
[ ] SLVR: fact: test_api 0.2.11 depends on pedantic ^1.0.0
[ ] SLVR: fact: test_api 0.2.11 depends on source_span ^1.4.0
[ ] SLVR: fact: test_api 0.2.11 depends on stack_trace ^1.9.0
[ ] SLVR: fact: test_api 0.2.11 depends on stream_channel >=1.7.0 <3.0.0
[ ] SLVR: fact: test_api 0.2.11 depends on string_scanner ^1.0.0
[ ] SLVR: fact: test_api 0.2.11 depends on term_glyph ^1.0.0
[ ] SLVR: fact: test_api 0.2.11 depends on matcher >=0.12.6 <0.12.7
[ ] SLVR: selecting test_api 0.2.11
[ ] SLVR: fact: http_parser 3.1.3 depends on charcode ^1.1.0
[ ] SLVR: fact: http_parser 3.1.3 depends on collection >=0.9.1 <2.0.0
[ ] SLVR: fact: http_parser 3.1.3 depends on source_span ^1.0.0
[ ] SLVR: fact: http_parser 3.1.3 depends on string_scanner >=0.0.0 <2.0.0
[ ] SLVR: fact: http_parser 3.1.3 depends on typed_data ^1.1.0
[ ] SLVR: selecting http_parser 3.1.3
[ ] SLVR: selecting sky_engine 0.0.99 from sdk
[ ] SLVR: Version solving took 0:00:00.163385 seconds.
[ ] | Tried 1 solutions.
[ ] FINE: Resolving dependencies finished (0.169s).
[ ] IO : Writing 4815 characters to text file ./pubspec.lock.
[ ] FINE: Contents:
[ ] | # Generated by pub
[ ] | # See https://dart.dev/tools/pub/glossary#lockfile
[ ] | packages:
[ ] | archive:
[ ] | dependency: transitive
[ ] | description:
[ ] | name: archive
[ ] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "2.0.11"
[ ] | args:
[ ] | dependency: transitive
[ ] | description:
[ ] | name: args
[ ] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "1.5.2"
[ ] | async:
[ ] | dependency: transitive
[ ] | description:
[ ] | name: async
[ ] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "2.4.0"
[ ] | boolean_selector:
[ ] | dependency: transitive
[ ] | description:
[ ] | name: boolean_selector
[ ] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "1.0.5"
[ ] | charcode:
[ ] | dependency: transitive
[ ] | description:
[ ] | name: charcode
[ +2 ms] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "1.1.2"
[ ] | collection:
[ ] | dependency: transitive
[ ] | description:
[ ] | name: collection
[ ] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "1.14.11"
[ ] | convert:
[ ] | dependency: transitive
[ ] | description:
[ ] | name: convert
[ ] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "2.1.1"
[ ] | crypto:
[ ] | dependency: transitive
[ ] | description:
[ ] | name: crypto
[ ] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "2.1.3"
[ ] | cupertino_icons:
[ ] | dependency: "direct main"
[ ] | description:
[ ] | name: cupertino_icons
[ ] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "0.1.3"
[ ] | flutter:
[ ] | dependency: "direct main"
[ ] | description: flutter
[ ] | source: sdk
[ ] | version: "0.0.0"
[ ] | flutter_test:
[ ] | dependency: "direct dev"
[ ] | description: flutter
[ ] | source: sdk
[ ] | version: "0.0.0"
[ ] | http:
[ ] | dependency: "direct main"
[ ] | description:
[ ] | name: http
[ ] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "0.12.0+4"
[ ] | http_parser:
[ ] | dependency: transitive
[ ] | description:
[ ] | name: http_parser
[ ] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "3.1.3"
[ ] | image:
[ ] | dependency: transitive
[ ] | description:
[ ] | name: image
[ ] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "2.1.4"
[ ] | matcher:
[ ] | dependency: transitive
[ ] | description:
[ ] | name: matcher
[ ] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "0.12.6"
[ ] | meta:
[ ] | dependency: transitive
[ ] | description:
[ ] | name: meta
[ ] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "1.1.8"
[ ] | path:
[ ] | dependency: transitive
[ ] | description:
[ ] | name: path
[ ] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "1.6.4"
[ ] | pedantic:
[ ] | dependency: transitive
[ ] | description:
[ ] | name: pedantic
[ ] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "1.8.0+1"
[ ] | petitparser:
[ ] | dependency: transitive
[ ] | description:
[ ] | name: petitparser
[ ] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "2.4.0"
[ ] | quiver:
[ ] | dependency: transitive
[ ] | description:
[ ] | name: quiver
[ ] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "2.0.5"
[ ] | sky_engine:
[ ] | dependency: transitive
[ ] | description: flutter
[ ] | source: sdk
[ ] | version: "0.0.99"
[ ] | source_span:
[ ] | dependency: transitive
[ ] | description:
[ ] | name: source_span
[ ] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "1.5.5"
[ ] | stack_trace:
[ ] | dependency: transitive
[ ] | description:
[ ] | name: stack_trace
[ ] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "1.9.3"
[ ] | stream_channel:
[ ] | dependency: transitive
[ ] | description:
[ ] | name: stream_channel
[ ] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "2.0.0"
[ ] | string_scanner:
[ ] | dependency: transitive
[ ] | description:
[ ] | name: string_scanner
[ ] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "1.0.5"
[ ] | term_glyph:
[ ] | dependency: transitive
[ ] | description:
[ ] | name: term_glyph
[ ] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "1.1.0"
[ ] | test_api:
[ ] | dependency: transitive
[ ] | description:
[ ] | name: test_api
[ ] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "0.2.11"
[ ] | typed_data:
[ ] | dependency: transitive
[ ] | description:
[ ] | name: typed_data
[ ] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "1.1.6"
[ ] | vector_math:
[ ] | dependency: transitive
[ ] | description:
[ ] | name: vector_math
[ ] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "2.0.8"
[ ] | xml:
[ ] | dependency: "direct main"
[ ] | description:
[ ] | name: xml
[ ] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "3.5.0"
[ ] | xml2json:
[ ] | dependency: "direct main"
[ ] | description:
[ ] | name: xml2json
[ ] | url: "https://pub.dartlang.org"
[ ] | source: hosted
[ ] | version: "4.1.1"
[ ] | sdks:
[ ] | dart: ">=2.4.0 <3.0.0"
[ ] IO : Writing 2714 characters to text file ./.packages.
[ ] FINE: Contents:
[ ] | # Generated by pub on 2020-02-26 17:40:54.355096.
[ ] | archive:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/archive-2.0.11/lib/
[ ] | args:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/args-1.5.2/lib/
[ ] | async:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/async-2.4.0/lib/
[ ] | boolean_selector:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/boolean_selector-1.0.5/lib/
[ ] | charcode:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.2/lib/
[ ] | collection:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/collection-1.14.11/lib/
[ ] | convert:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/convert-2.1.1/lib/
[ ] | crypto:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/crypto-2.1.3/lib/
[ ] | cupertino_icons:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/
[ ] | flutter:file:///home/kannalo/Android/flutter/packages/flutter/lib/
[ ] | flutter_test:file:///home/kannalo/Android/flutter/packages/flutter_test/lib/
[ ] | http:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+4/lib/
[ ] | http_parser:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/http_parser-3.1.3/lib/
[ ] | image:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/image-2.1.4/lib/
[ ] | matcher:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.6/lib/
[ ] | meta:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/meta-1.1.8/lib/
[ ] | path:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/path-1.6.4/lib/
[ ] | pedantic:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/pedantic-1.8.0+1/lib/
[ ] | petitparser:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/petitparser-2.4.0/lib/
[ ] | quiver:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/quiver-2.0.5/lib/
[ ] | sky_engine:file:///home/kannalo/Android/flutter/bin/cache/pkg/sky_engine/lib/
[ ] | source_span:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/source_span-1.5.5/lib/
[ ] | stack_trace:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.9.3/lib/
[ ] | stream_channel:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/stream_channel-2.0.0/lib/
[ ] | string_scanner:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.0.5/lib/
[ ] | term_glyph:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.1.0/lib/
[ ] | test_api:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/test_api-0.2.11/lib/
[ ] | typed_data:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/typed_data-1.1.6/lib/
[ ] | vector_math:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/vector_math-2.0.8/lib/
[ ] | xml:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/xml-3.5.0/lib/
[ ] | xml2json:file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/xml2json-4.1.1/lib/
[ ] | lolisnatcher_droid:lib/
[ ] IO : Writing 6144 characters to text file ./.dart_tool/package_config.json.
[ ] FINE: Contents:
[ ] | {
[ ] | "configVersion": 2,
[ ] | "packages": [
[ ] | {
[ ] | "name": "archive",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/archive-2.0.11",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "2.0"
[ ] | },
[ ] | {
[ ] | "name": "args",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/args-1.5.2",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "2.0"
[ ] | },
[ ] | {
[ ] | "name": "async",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/async-2.4.0",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "2.0"
[ ] | },
[ ] | {
[ ] | "name": "boolean_selector",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/boolean_selector-1.0.5",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "2.0"
[ ] | },
[ ] | {
[ ] | "name": "charcode",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.2",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "1.0"
[ ] | },
[ ] | {
[ ] | "name": "collection",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/collection-1.14.11",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "2.0"
[ ] | },
[ ] | {
[ ] | "name": "convert",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/convert-2.1.1",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "1.17"
[ ] | },
[ ] | {
[ ] | "name": "crypto",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/crypto-2.1.3",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "2.1"
[ ] | },
[ ] | {
[ ] | "name": "cupertino_icons",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "2.0"
[ ] | },
[ ] | {
[ ] | "name": "flutter",
[ ] | "rootUri": "file:///home/kannalo/Android/flutter/packages/flutter",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "2.2"
[ ] | },
[ ] | {
[ ] | "name": "flutter_test",
[ ] | "rootUri": "file:///home/kannalo/Android/flutter/packages/flutter_test",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "2.2"
[ ] | },
[ ] | {
[ ] | "name": "http",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+4",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "2.4"
[ ] | },
[ ] | {
[ ] | "name": "http_parser",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/http_parser-3.1.3",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "2.0"
[ ] | },
[ ] | {
[ ] | "name": "image",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/image-2.1.4",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "2.0"
[ ] | },
[ ] | {
[ ] | "name": "matcher",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.6",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "2.2"
[ ] | },
[ ] | {
[ ] | "name": "meta",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/meta-1.1.8",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "1.12"
[ ] | },
[ ] | {
[ ] | "name": "path",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/path-1.6.4",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "2.0"
[ ] | },
[ ] | {
[ ] | "name": "pedantic",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/pedantic-1.8.0+1",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "2.1"
[ ] | },
[ ] | {
[ ] | "name": "petitparser",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/petitparser-2.4.0",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "2.4"
[ ] | },
[ ] | {
[ ] | "name": "quiver",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/quiver-2.0.5",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "2.0"
[ ] | },
[ ] | {
[ ] | "name": "sky_engine",
[ ] | "rootUri": "file:///home/kannalo/Android/flutter/bin/cache/pkg/sky_engine",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "1.11"
[ ] | },
[ ] | {
[ ] | "name": "source_span",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/source_span-1.5.5",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "1.8"
[ ] | },
[ ] | {
[ ] | "name": "stack_trace",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.9.3",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "1.23"
[ ] | },
[ ] | {
[ ] | "name": "stream_channel",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/stream_channel-2.0.0",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "2.0"
[ ] | },
[ ] | {
[ ] | "name": "string_scanner",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.0.5",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "2.0"
[ ] | },
[ ] | {
[ ] | "name": "term_glyph",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.1.0",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "1.8"
[ ] | },
[ ] | {
[ ] | "name": "test_api",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/test_api-0.2.11",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "2.2"
[ ] | },
[ ] | {
[ ] | "name": "typed_data",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/typed_data-1.1.6",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "2.0"
[ ] | },
[ ] | {
[ ] | "name": "vector_math",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/vector_math-2.0.8",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "2.0"
[ ] | },
[ ] | {
[ ] | "name": "xml",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/xml-3.5.0",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "2.3"
[ ] | },
[ ] | {
[ ] | "name": "xml2json",
[ ] | "rootUri": "file:///home/kannalo/.pub-cache/hosted/pub.dartlang.org/xml2json-4.1.1",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "2.0"
[ ] | },
[ ] | {
[ ] | "name": "lolisnatcher_droid",
[ ] | "rootUri": "../",
[ ] | "packageUri": "lib/",
[ ] | "languageVersion": "2.1"
[ ] | }
[ ] | ],
[ ] | "generated": "2020-02-26T17:40:54.369715Z",
[ ] | "generator": "pub",
[ ] | "generatorVersion": "2.7.0"
[ ] | }
[ +29 ms] Running "flutter pub get" in lolisnatcher_droid... (completed in 0.5s)
[ +137 ms] Generating /home/kannalo/AndroidStudioProjects/lolisnatcher_droid/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
[ +17 ms] ro.hardware = ranchu
[ +17 ms] Using hardware rendering with device Android SDK built for x86. If you get graphics artifacts, consider enabling software rendering with
"--enable-software-rendering".
[ +16 ms] Launching lib/main.dart on Android SDK built for x86 in debug mode...
[ +11 ms] executing: /home/kannalo/Android/Sdk/platform-tools/adb -s emulator-5554 shell -x logcat -v time -t 1
[ +95 ms] Exit code 0 from: /home/kannalo/Android/Sdk/platform-tools/adb -s emulator-5554 shell -x logcat -v time -t 1
[ ] --------- beginning of main
02-26 17:40:42.508 E/GnssHAL_GnssInterface( 1797): gnssSvStatusCb: b: input svInfo.flags is 8
[ +14 ms] executing: /home/kannalo/Android/Sdk/platform-tools/adb version
[ +1 ms] executing: /home/kannalo/Android/Sdk/platform-tools/adb -s emulator-5554 logcat -v time -T 02-26 17:40:42.508
[ +33 ms] Android Debug Bridge version 1.0.41
Version 29.0.6-6198805
Installed as /home/kannalo/Android/Sdk/platform-tools/adb
[ +4 ms] executing: /home/kannalo/Android/Sdk/platform-tools/adb start-server
[ +11 ms] Building APK
[ +19 ms] Running Gradle task 'assembleDebug'...
[ +1 ms] gradle.properties already sets `android.enableR8`
[ +4 ms] Using gradle from /home/kannalo/AndroidStudioProjects/lolisnatcher_droid/android/gradlew.
[ +8 ms] executing: /opt/android-studio/jre/bin/java -version
[ +48 ms] Exit code 0 from: /opt/android-studio/jre/bin/java -version
[ ] openjdk version "1.8.0_212-release"
OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
OpenJDK 64-Bit Server VM (build 25.212-b4-5784211, mixed mode)
[ +3 ms] executing: [/home/kannalo/AndroidStudioProjects/lolisnatcher_droid/android/] /home/kannalo/AndroidStudioProjects/lolisnatcher_droid/android/gradlew
-Pverbose=true -Ptarget=/home/kannalo/AndroidStudioProjects/lolisnatcher_droid/lib/main.dart -Ptrack-widget-creation=true -Pfilesystem-scheme=org-dartlang-root
-Ptarget-platform=android-x86 assembleDebug
[kannalo@loliBox lolisnatcher_droid]$ ~/Android/flutter/bin/flutter analyze
Analyzing lolisnatcher_droid...
info • The declaration '_getItems' isn't referenced • lib/libBooru/BooruHandler.dart:6:8 • unused_element
info • This function has a return type of 'List', but doesn't end with a return statement • lib/libBooru/BooruHandler.dart:6:8 • missing_return
info • Unused import: 'package:xml/xml.dart' • lib/libBooru/GelbooruHandler.dart:3:8 • unused_import
info • Unused import: 'BooruItem.dart' • lib/libBooru/GelbooruHandler.dart:9:8 • unused_import
info • Name non-constant identifiers using lowerCamelCase • lib/libBooru/GelbooruHandler.dart:16:10 • non_constant_identifier_names
info • The declaration '_getItems' isn't referenced • lib/libBooru/GelbooruHandler.dart:28:8 • unused_element
info • The declaration '_getFileURL' isn't referenced • lib/libBooru/GelbooruHandler.dart:29:10 • unused_element
info • This function has a return type of 'String', but doesn't end with a return statement • lib/libBooru/GelbooruHandler.dart:29:10 • missing_return
info • The declaration '_getSampleURL' isn't referenced • lib/libBooru/GelbooruHandler.dart:30:10 • unused_element
info • This function has a return type of 'String', but doesn't end with a return statement • lib/libBooru/GelbooruHandler.dart:30:10 • missing_return
info • The declaration '_getThumbnailURL' isn't referenced • lib/libBooru/GelbooruHandler.dart:31:10 • unused_element
info • This function has a return type of 'String', but doesn't end with a return statement • lib/libBooru/GelbooruHandler.dart:31:10 • missing_return
info • The declaration '_getTags' isn't referenced • lib/libBooru/GelbooruHandler.dart:32:10 • unused_element
info • This function has a return type of 'String', but doesn't end with a return statement • lib/libBooru/GelbooruHandler.dart:32:10 • missing_return
info • The declaration '_getPostURL' isn't referenced • lib/libBooru/GelbooruHandler.dart:33:10 • unused_element
info • This function has a return type of 'String', but doesn't end with a return statement • lib/libBooru/GelbooruHandler.dart:33:10 • missing_return
[kannalo@loliBox lolisnatcher_droid]$ ~/Android/flutter/bin/flutter doctor -v
[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Linux, locale en_US.UTF-8)
• Flutter version 1.12.13+hotfix.8 at /home/kannalo/Android/flutter
• Framework revision 0b8abb4724 (2 weeks ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /home/kannalo/Android/Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.3
• ANDROID_HOME = /home/kannalo/Android/Sdk
• Java binary at: /opt/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.
[✓] Android Studio (version 3.6)
• Android Studio at /opt/android-studio
• Flutter plugin version 43.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[✓] IntelliJ IDEA Ultimate Edition (version 2019.3)
• IntelliJ at /opt/intellij-idea-ultimate-edition
• Flutter plugin version 43.0.3
• Dart plugin version 193.6015.53
[✓] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• No issues found!
[kannalo@loliBox lolisnatcher_droid]$
On an XML with embedded data URI and SVG element text, parsing and then subsequent findAllElements takes several seconds and hangs the browser while parsing.
There's only about 3000 XML elements in the file, but with embedded data, is about 2.3 MB.
Same file when using responseXML is about one second.
It's an issue because I can't use the library as is. Trying xml_stream with my own search routines.
When I use the following line in debug mode or compile a debug build it works fine but when I try to make a profile or release build the consumes all memory then crashes. Here's a snippet:
// Open up the xml file of recipes
String recipesXML = await rootBundle.loadString('xmlfiles/recipes.xml');
// Open up the xml parser and parse in the recipes
xml.XmlDocument recipebook = xml.parse(recipesXML);
// get an iterator that can walk through the list of recipes
Iterable<xml.XmlElement> recipeObjs = recipebook.findAllElements('RcpE');
Iterable<xml.XmlElement> subObjs;
for (int idx = 0; idx < numRecipes; idx++) {
recipes.add(new Recipe.empty());
recipes.elementAt(idx).name =
recipeObjs.elementAt(idx).getAttribute("name").toString();
recipes.elementAt(idx).author =
recipeObjs.elementAt(idx).getAttribute("author").toString();
recipes.elementAt(idx).imagePath = 'photos/' +
recipes
.elementAt(idx)
.name
.replaceAll(' ', '_')
.replaceAll('&', 'and')
.replaceAll('-', '_')
.replaceAll("'", '')
.replaceAll('__', '_')
.replaceAll(',', '')
.toLowerCase() +
'.jpg';
// get servings
subObjs = recipeObjs.elementAt(idx).findElements('Serv');
// THE BELOW LINE CAUSES RELEASE or PROFILE BUILDS TO FAIL
recipes.elementAt(idx).servings =
int.tryParse(subObjs.elementAt(0).getAttribute("qty")) ?? 1;
Instead of having the parse()
function as a global function, could this be moved to be a static method under the XmlDocument
class?
The XML package is parsing the escape codes (since it’s not a dart escape code in anycase), but it could have a method to return the raw string. So, in the next example code, should return "␍" instead of an Unicode character.
import 'package:xml/xml.dart' as xml;
const data = '''
<?xml version="1.0"?>
<meta>
<Reference>
<value>␍</value>
</Reference>
</meta>
''';
main() async {
var document = xml.parse(data);
var res = document.findAllElements('Reference')
.expand((node) => node.findElements('value'))
.map((node) => node.text); // It's converted to unicode
print(res);
}
I have a functionality to read only "firstName","age" children of a XMLElement("metadata").
<metadata>
<firstName>test</firstName>
<lastName>user</lastName>
<age>20</age>
<gender>M</gender>
</metadata>
As there is no such property "name" on XMLNode, it is not convenient to extract name from the XMLNode string.
Can "name" property be added to XMLNode object.
Is this a feature to be implemented or a design decision?
If intentional, then please suggest alternative way to do this apart from string manipulation.
Hi Rengli,
I don't know what you're working on but has anyone from the Flutter team asked you to take a look at XML serialization? Like Flutter/JSON.
I know everyone is using JSON now because it's often shorter and faster to transmit but I like XML because its both human and machine readable.
I have not raised this on the main flutter/issues page. I'm sure you're in a better place than I am to converse with the flutter guys about this possible feature addition to the flutter framework.
Tschüss
Hi,
are there any plans for an official google repo to convert xml to json and json to xml?
Trying to follow the most basic code from the docs and what's wrong with this code that's it's producing error?
import 'package:xml/xml.dart' as xml;
void main(){
var bookshelfXml = '''<?xml version="1.0"?>
<bookshelf>
<book>
<title lang="english">Growing a Language</title>
<price>29.99</price>
</book>
<book>
<title lang="english">Learning XML</title>
<price>39.95</price>
</book>
<price>132.00</price>
</bookshelf>''';
var document = xml.parse(bookshelfXml);
print(document.toString());
print('-------------------');
var textual = document.descendants
.where((node) => node is XmlText && !node.text.trim().isEmpty)
.join('\n');
print(textual);
//the following works fine.
// var titles = document.findAllElements('title');
// titles
// .map((node) => node.text)
// .forEach(print);
}
the error produced is;
Unhandled exception:
'file:///home/xxxxx/dart/xmlXSLT/bookxml.dart': malformed type: line 21 pos 30: type 'XmlText' is not loaded
.where((node) => node is XmlText && !node.text.trim().isEmpty)
^
#0 _TypeError._throwNew (dart:core-patch/errors_patch.dart:65)
#1 main.<anonymous closure> (file:///home/iveagh/dart/xmlXSLT/bookxml.dart:21:30)
#2 WhereIterator.moveNext (dart:_internal/iterable.dart:439)
#3 Iterable.join (dart:core/iterable.dart:303)
#4 main (file:///home/iveagh/dart/xmlXSLT/bookxml.dart:22:6)
#5 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:261)
#6 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:148)
Thanks for the plugin. Please bear with me. I am new to XML.
I use in my app to create basic xml and it is very fast.
The example below uses nested and list type xml. It uses xml body than and than single and also some kind of list type like and .
My question is how to create a nested and list type xml?
EXAMPLE
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<sendSms xmlns="http://webservice.proxy.mysite.com/">
<msg xmlns="">
<body>
<messages>
<message>
<chargingMultiplier>0.0</chargingMultiplier>
<contentList>
<content>
<msgContent>Your Two-Way-Auth: 098765</msgContent>
<msgId>2222222</msgId>
<rpid>1</rpid>
</content>
</contentList>
<dstMsisdnList>
<msisdn>5338888888</msisdn>
</dstMsisdnList>
<msgCode>1234</msgCode>
<notificationNeeded>T</notificationNeeded>
<sender>5337777777</sender>
<validityPeriod>3</validityPeriod>
<variantId>3201910234567</variantId>
</message>
</messages>
</body>
<header>
<registerId>123445677890</registerId>
</header>
</msg>
</sendSms>
</soapenv:Body>
</soapenv:Envelope>
Maybe I used this plugin in wrong way,but if I want to use an XML file encoded by dbcs, such as gbk, the program will go wrong. With the help of gbk2utf8, it can run normally.
Is it possible to support DBCS encoding like GBK in future?
I have a very big XML file about 50k+ element with in and for me on iOS the parse function looks like to hangs the UI of the application. A tried it out with a loading spinner and every time under the loading process it hangs for a while.
Also I tried it with flutters compute method and it produces the same for me.
Am I doing something very wrong? How should iI parse the xml file to a document in a correct way in the background not blocking any UI stuff in the foreground?
While trying to parse some xml, i get this:
Compiler message:
file:///home/kevin/flutter/.pub-cache/hosted/pub.dartlang.org/xml-3.2.2/lib/xml.dart:43:25: Error: Method not found: 'ParserError'.
throw ArgumentError(ParserError(result).toString());
^^^^^^^^^^^
Am I missing something?
Hi Renggli, guys,
Do you mind providing an example of adding a namespace if you have any spare time?
I'm trying to follow the constructors and data types but the code is still giving up errors. Could you post an example of adding a namespace with the bookshelf.xml builder or something like that?
What would be the correct use of namespace declaration for the whole document and then namespaces for individual elements and their attributes using the builder?
builder.namespace(String uri, [String prefix])
builder.element(String name, {String namespace: null, Map<String, String> namespaces: const {, Map<String, String> attributes: const {}, dynamic nest: null}})
How would i add a namespace to an attribute?
builder.attribute(String name, dynamic value, {String namespace})
With the optimisenamespaces would it just be set to 'true'?
builder.optimizeNamespaces
Any help or guidance you can offer would be appreciated. later
I want to parse XML with many different node names, I have no possibility to get the tag name of a node: e.G.:
<tagname>value</tagname>
AFAIK I have can get the value
with node.text
, but I can´t get the <tagname>
. Am I doing something wrong or can this feature be added?
Hi there,
I need an advise please.
Basically I'm parsing a xml file using this plugins:
xml: ^3.5.0
http: ^0.12.0+2
and the xml have inside tags for persons and inside that person it have a sub-tag with multiple categories and I have no idea how to embed and can't find information about it.
<Reader>
<Name>Gabriella</Name>
<Description>this is a description</Description>
<Status>Available</Status>
<Pin>78575</Pin>
<Picture>
http://xxx.com/blabla.jpg
</Picture>
<Categories>
<Category name="Tools">
<Skill>Sand</Skill>
<Skill>Rock</Skill>
</Category>
<Category name="Languages">
<Skill>English</Skill>
<Skill>German</Skill>
</Category>
</Categories>
</Reader>
I'm using this bit of code:
http.Response response = await http.get(readers_feed);
List<ReaderModel> _listReader = [];
var parser = xml.parse(response.body);
parser.findAllElements('Reader').forEach((node) {
ReaderModel _readerModel;
String readerPin = node.findElements('Pin').first.text;
if (readerPin.isNotEmpty) {
_readerModel = ReaderModel(
readerPin: readerPin,
readerName: node.findElements('Name').first.text,
readerDescription: node.findElements('Description').first.text,
readerStatus: node.findElements('Status').first.text);
_listReader.add(_readerModel);
}
});
Can you advise please? Thank you
Hi,
I'd like for XmlBuilder to have more features and include commands for working with .xsl and .xsd files.
If i knew how to do it myself then I'd perform a pull request but I have a lot to learn with dart so perhaps some other programmers could help if they have the time. I will keep trying also.
I have a stackoverflow question about this.
I'm just a little puzzled. I thought dart would have hit up against SGML before. Is everyone using JSON for accessing their db's through the server?
I know some parts of xml got ugly with large config files but I like that it's extensible and both human and computer readable. I just think dart should have more Xml support overall. Xslt is an easy enough way to create Html pages from xml data and I think dart should have these programming tools on call.
sincerely,
lubi
Hi,
Thanks for xml plugin. I made a small app for example. Please update https://pub.dartlang.org/packages/xml
I mange to build xml in Flutter and be able to post and get the response. Here is the code:
DEPENDENCIES:
// Add pubspec.yaml: xml: "^3.2.1"
import 'package:xml/xml.dart' as xml;
import 'dart:io';
BUILD XML:
// TODO: BUILD XML FILE
Future<HttpClientResponse> _sendOTP() async {
var builder = new xml.XmlBuilder();
builder.processing('xml', 'version="1.0" encoding="iso-8859-9"');
builder.element('MainmsgBody', nest: () {
builder.element('UserName', nest: “xxxxxxxx”);
builder.element('PassWord', nest: “yyyyyyyy”);
builder.element('Action', nest: 5);
builder.element('Mesgbody', nest: “I am Fluttering with Dart”);
builder.element('Numbers', nest: 5);
});
var bookshelfXml = builder.build();
String _uriMsj = bookshelfXml.toString();
print("_uriMsj: $_uriMsj");
String _uri = "https://*******.******.com/http****”;
var _responseOtp = postOTP(_uri, _uriMsj);
print("_responseOtp: $_responseOtp");
}
POST XML:
// TODO: POST XML FILE
Future<String> postOTP(String _uri, String _message) async {
HttpClient client = new HttpClient();
HttpClientRequest request = await client.postUrl(Uri.parse(_uri));
request.write(_message);
HttpClientResponse response = await request.close();
StringBuffer _buffer = new StringBuffer();
await for(String a in await response.transform(utf8.decoder)) {
_buffer.write(a);
}
print("_buffer.toString: ${_buffer.toString()}");
return _buffer.toString();
}
Create a brand new Flutter app (beta 2, version 0.2.8), added in the sample code in the README file for reading XML and the following exception occurs
I/flutter ( 5573): type 'List<dynamic>' is not a subtype of type 'Iterable<XmlNode>' in type cast where
I/flutter ( 5573): List is from dart:core
I/flutter ( 5573): Iterable is from dart:core
I/flutter ( 5573): XmlNode is from package:xml/xml/nodes/node.dart
Hello,
I ran into an issue where parsing an XML document and then calling doc.toXmlString()
on it does not produce the same output (ignoring white space characters).
I created a GIST of it here, I think the test case details the issue quite well.
TL;DR:
if an XmlNode contains >
it gets encoded when calling toXmlString().
Pointer: XmlWriter.visitText
Request: there should be a way to output an XML String in such a way that XmlText
nodes' contents do not get encoded.
Your library is very good, but validating XML via DTD is needed.
Attributes can be in a specific namespace - the API doesn't support this currently.
When parsing any XML in Flutter dart-xml is parsing the line breaks between elements as individual elements. This means that it is impossible to iterate through a list of nodes without 50% being filtered out. Additionally, the length of children (should be 2 not 3) and descendants (should be 12-13 not 27) is wrong.
I'm running the latest Flutter, Dart 2.0 and dart-xml 3.0.0.
My code:
var bookshelfXml = '''<?xml version="1.0"?>
<bookshelf>
<book>
<title lang="english">Growing a Language</title>
<price>29.99</price>
</book>
`<book>`
<title lang="english">Learning XML</title>
<price>39.95</price>
</book>
<price>132.00</price>
</bookshelf>''';
print ('Bookshelf Children');
print (xml.parse(bookshelfXml).children.length);
print (xml.parse(bookshelfXml).children);
print ('Bookshelf Descendants');
print (xml.parse(bookshelfXml).descendants.length);
print (xml.parse(bookshelfXml).descendants);
Printout on console:
`I/flutter ( 2838): Bookshelf Children
I/flutter ( 2838): 3
I/flutter ( 2838): [<?xml version="1.0"?>,
I/flutter ( 2838): , <bookshelf>
I/flutter ( 2838): <book>
I/flutter ( 2838): <title lang="english">Growing a Language</title>
I/flutter ( 2838): <price>29.99</price>
I/flutter ( 2838): </book>
I/flutter ( 2838): <book>
I/flutter ( 2838): <title lang="english">Learning XML</title>
I/flutter ( 2838): <price>39.95</price>
I/flutter ( 2838): </book>
I/flutter ( 2838): <price>132.00</price>
I/flutter ( 2838): </bookshelf>]
I/flutter ( 2838): Bookshelf Descendants
I/flutter ( 2838): 27
I/flutter ( 2838): (<?xml version="1.0"?>,
I/flutter ( 2838): , <bookshelf>
I/flutter ( 2838): <book>
I/flutter ( 2838): <title lang="english">Growing a Language</title>
I/flutter ( 2838): <price>29.99</price>
I/flutter ( 2838): </book>
I/flutter ( 2838): <book>
I/flutter ( 2838): <title lang="english">Learning XML</title>
I/flutter ( 2838): <price>39.95</price>
I/flutter ( 2838): </book>
I/flutter ( 2838): <price>132.00</price>
I/flutter ( 2838): </bookshelf>, ..., 132.00,
I/flutter ( 2838): )`
pubspec.lock:
packages:
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "0.31.1"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.2"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.6"
barback:
dependency: transitive
description:
name: barback
url: "https://pub.dartlang.org"
source: hosted
version: "0.15.2+15"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
cli_util:
dependency: transitive
description:
name: cli_util
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2+1"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.6"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2+1"
csslib:
dependency: transitive
description:
name: csslib
url: "https://pub.dartlang.org"
source: hosted
version: "0.14.1"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
front_end:
dependency: transitive
description:
name: front_end
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0-alpha.9"
glob:
dependency: transitive
description:
name: glob
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.5"
html:
dependency: transitive
description:
name: html
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.3"
http:
dependency: transitive
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.11.3+16"
http_multi_server:
dependency: transitive
description:
name: http_multi_server
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.1"
io:
dependency: transitive
description:
name: io
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.2+1"
isolate:
dependency: transitive
description:
name: isolate
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.1"
kernel:
dependency: transitive
description:
name: kernel
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0-alpha.9"
logging:
dependency: transitive
description:
name: logging
url: "https://pub.dartlang.org"
source: hosted
version: "0.11.3+1"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.1+4"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
mime:
dependency: transitive
description:
name: mime
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.6"
multi_server_socket:
dependency: transitive
description:
name: multi_server_socket
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
node_preamble:
dependency: transitive
description:
name: node_preamble
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.0"
package_config:
dependency: transitive
description:
name: package_config
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
package_resolver:
dependency: transitive
description:
name: package_resolver
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.1"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.6"
plugin:
dependency: transitive
description:
name: plugin
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0+2"
pool:
dependency: transitive
description:
name: pool
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.4"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.6"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "0.29.0+1"
shelf:
dependency: transitive
description:
name: shelf
url: "https://pub.dartlang.org"
source: hosted
version: "0.7.2"
shelf_packages_handler:
dependency: transitive
description:
name: shelf_packages_handler
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
shelf_static:
dependency: transitive
description:
name: shelf_static
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.7"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.2"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
source_map_stack_trace:
dependency: transitive
description:
name: source_map_stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.4"
source_maps:
dependency: transitive
description:
name: source_maps
url: "https://pub.dartlang.org"
source: hosted
version: "0.10.4"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.2"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.4"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
test:
dependency: transitive
description:
name: test
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.34"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.5"
utf:
dependency: transitive
description:
name: utf
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.0+4"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.6"
watcher:
dependency: transitive
description:
name: watcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.7+7"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.7"
xml:
dependency: "direct main"
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
yaml:
dependency: transitive
description:
name: yaml
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.13"
sdks:
dart: ">=2.0.0-dev.28.0 <=2.0.0-edge.af1436931b93e755d38223c487d33a0a1f5eadf5"
Hi, I'm refactoring some code that used the original dart-xml from John Evans to this library. I've come across the namespace limitation - something that for the most part the original library supported. It would at least have the namespaces in scope traverse with the elements, and you could look up the uri based on the prefix. Do you have on your roadmap support for namespaces? If so, when do you anticipate having that in?
Thanks,
-D
Hi!
I'm having problem parsing xml files that contain a DOCTYPE that references to an external dtd.
The code below produce the following error: [:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、豈-﷏ﷰ-�] expected at 2:2
Example:
var xmlData = '''<?xml version="1.0"?>
<!DOCTYPE book SYSTEM "Book.dtd">
<bookshelf>
<book>
<title lang="english">Growing a Language</title>
<price>29.99</price>
</book>
<book>
<title lang="english">Learning XML</title>
<price>39.95</price>
</book>
<price>132.00</price>
</bookshelf>''';
var doc = parse(xmlData);
Hi! After working with xml I thought that it would be nice if XmlDocument had method like mapAttributes
or attributesAsMap()
which would simply return Map<String, String>
where key
would be attribute name and value
would be attribute value. Which is one line change it's easy to add so I think I can add that if you accept PR and are fine with this idea.
I think it would be much more convenient and faster (in terms of performance) to use something like this to access attribute on xmlNode:
element.attributes['attr1'].value
instead of:
element.attributes.firstWhere((XmlAttribute e)=>e.name.qualified=="attr1").value
Also this way would be much easier to detect attribute duplicates, which are not allowed in XML.
Hi,
I am getting version solving failed when trying to install the package version 3.4.0 or 3.5.0,
> flutter packages get
> Running "flutter packages get"..
> The current Dart SDK version is 2.3.0-dev.0.5.flutter-a1668566e5.
>
>
>
> Because wp_client depends on xml >=3.5.0 which requires SDK version >=2.3.0 <3.0.0, version solving failed.
> pub get failed (1)
> exit code 1
Running flutter -version:
Flutter 1.5.4-hotfix.2 • channel stable • https://github.com/flutter/flutter.git Framework • revision 7a4c33425d (5 weeks ago) • 2019-04-29 11:05:24 -0700 Engine • revision 52c7a1e849 Tools • Dart 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)
My pubspec.yaml
environment: sdk: ">=2.2.2 <3.0.0"
Hey, I was thinking if there's a way to make the parse()
function tolerate non well-formated XML which is very common when parsing HTML. For example:
<div>
<p>Lorem ipsum</p>
</p>
I know this is incorrect but from my experience, parsers in Python or PHP report this only as warning and can handle it without throwing exceptions. Unfortunatelly, this is very common when parsing nearly any real world HTML, so it would be great if parse()
could somehow gracefuly ignore it.
The pub site can show example code for a package.
https://www.dartlang.org/tools/pub/package-layout#examples
Let me know if you want me to try working on this.
related issue : dart-lang/site-www#413
Hey Lukas,
I’m thinking of forking your XML package to retain and expose line and column number ranges for XML attributes and elements. This could be useful for in-place editing and the like.
I’m curious how you would change you parsing strategy to retain these ranges?
Since presumably there's no situation where an XmlOwned.parent
node won't be a parent, it seems like XmlParent
should be the return type of that getter.
I am getting a parser exception with following string as content in the below 'staged' variable. This worked before the update to dart 2.0:
<InstantaneousDemand><DeviceMacId>0xd8d5b9000000b3e8</DeviceMacId><MeterMacId>0x00135003007c27b4</MeterMacId><TimeStamp>0x2244aeb3</TimeStamp><Demand>0x0006c1</Demand><Multiplier>0x00000001</Multiplier><Divisor>0x000003e8</Divisor><DigitsRight>0x03</DigitsRight><DigitsLeft>0x0f</DigitsLeft><SuppressLeadingZero>Y</SuppressLeadingZero></InstantaneousDemand>
this is the exception:
type 'List' is not a subtype of type 'Iterable' in type cast where
List is from dart:core
Iterable is from dart:cor
Map<String, String> parseXMLResult(http.Response response) {
final staged = response.body.replaceAll('\n', '').replaceAll(' ', '');
final document = xml.parse('<?xml?>$staged');
final result = <String, String>{};
...
C:\Projects\home_test>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel dev, v0.2.2-pre.2, on Microsoft Windows [Version 10.0.16299.309], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK 27.0.2)
[√] Android Studio (version 3.0)
[√] IntelliJ IDEA Community Edition (version 2017.2)
[√] VS Code, 32-bit edition (version 1.20.0)
[√] Connected devices (1 available)
• No issues found!
I am keep getting this error.
My question is which version of xml plugin I have to use?
I am using Channel stable, v1.12.13+hotfix.9, on Mac OS X 10.15.4 19E287 and my flutter doctor shows as:
flutter doctor --verbose
[✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Mac OS X 10.15.4 19E287, locale en-CY)
• Flutter version 1.12.13+hotfix.9 at /Users/**********/flutter
• Framework revision f139b11009 (5 weeks ago), 2020-03-30 13:57:30 -0700
• Engine revision af51afceb8
• Dart version 2.7.2
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/**********/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.4.1, Build version 11E503a
• CocoaPods version 1.8.4
[✓] Android Studio (version 3.6)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 45.1.1
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[✓] Connected device (1 available)
• SM G935F • ce12160c0d86152e01 • android-arm64 • Android 8.0.0 (API 26)
Hi and thanks for dart-xml
!
pub global activate junitreport
currently fails because 3.6.0 breaks backwards compatibility (in this case, constructor for XmlPrettyWriter
) although it was released using a semver minor bump.
Easy to work around by avoiding pub global
and instead constraining dev_dependency versions, but thought I'd mention.
I am getting the following error when using this library with dart 2.0
type 'List<dynamic>' is not a subtype of type 'Iterable<XmlNode>' in type cast where
List is from dart:core
Iterable is from
This error is thrown from XmlGrammarDefinition
and it is probably to do with the sound type system in Dart 2.0
data: "Material_Describe":"不锈钢管 BPE 1” PE <0.2umMP+EP A270 TP316L"
result: ""Material_Describe":"不锈钢管 BPE 1” PE <0.2umMP+EP A270 TP316L""
to update and save with changes?
I have an XSD that imports another XSD.
<xs:import namespace="http://www.opengis.net/gml" schemaLocation="gml.xsd"/>
As package:xml exists, attributes, children etc are final and not mutable.
XmlBranch(Iterable<XmlNode> children): children = children.toList(growable: false)
dart:html
DOM is mutable, which is useful for tree transformation.
Ideally, the library could handle an import statement by one or more:
xs:import
node could have a child XmlDocument
, etc.Why namespaces key and value has the key as the uri of namespace instead of the real key on xml?
Ex.:
var namespaces = <String, String>{
'soap' : 'http://www.w3.org/2003/05/soap-envelope/',
};
var builder = new xml.XmlBuilder();
builder.processing('xml', 'version="1.0"');
builder.element('soap:Envelop', namespaces: namespaces, nest: () { });
var result = builder.build();
produces:
<?xml version="1.0"?><soap:Envelop xmlns:http://schemas.xmlsoap.org/soap/envelope/="soap"/>
Consider the following example. When a property value is null, the xsi:nil="true"
attribute is added and thus the xsi
namespace should be defined. However, the <Property>
elements are built inside the XrdProperty
class so that it has no access to the <XRD>
element. The result is that the xsi
namespace is added twice. Preferably, the xsi
namespace is only defined in the <XRD>
element, not in <Link>
elements.
<?xml version="1.0" encoding="UTF-8"?>
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Property type="test-prop-null" xsi:nil="true" />
<Link rel="lrdd" template="https://openid.bar.eu/webfinger.json?q={uri}" type="application/jrd+json" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Property type="http://webhand.org/rel/origin">openid</Property>
<Property type="also-null-random-test" xsi:nil="true" />
</Link>
</XRD>
There are several possible solutions, listed in order of preference:
Currently, when parsing fails, it throws an XmlParserException
which is not a subclass of FormatException
. This is contrary to the typical Dart exception style, in which FormatException
is used for all format- or parser-related errors.
Ideally, it would even be a SourceSpanFormatException
, which provides a direct reference to the source location of the error and has a high-tech toString()
.
Since the rewrite of the package structure, the XmlPrettyPrinter has moved, breaking my code.
I suggest to expose it from xml.dart, to prevent future breakage.
I could really use this performance fix. :-)
I don't have a file I can share just as yet, but this diagram.xml file has a large embedded SVG and images encoded as URI.
Unfortunately, those large strings are attributes and not text elements.
I realize I should probably change the XML model, but I can't anytime soon.
Diagram: 2420642 diagram_export_1.xml
void main(){
group( "diagram", (){
test( "parse visit", (){
String xml = readFileTextSync("diagram_export_1.xml");
Stopwatch stopwatch = new Stopwatch()..start();
XmlDocument doc = parse(xml);
print( "parse time ${stopwatch.elapsed}");
stopwatch.reset();
DiaTransformer xform = new DiaTransformer();
DiaDoc dia = xform.visitDocument(doc);
print( "visit ${stopwatch.elapsed}");
});
});
}
unittest-suite-wait-for-done
parse time 0:00:20.558550
visit 0:00:00.010319
PASS: diagram parse visit
All 1 tests passed.
unittest-suite-success
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.