@Test public void testFromXml() throws Exception { final Agent agent = setUpAndRunAgent( "testFromXml (state <s> ^superstate nil ^io.input-link <il>) -->" + "(<il> ^xml (from-xml |" + "<ignored>" + "<location name='Ann Arbor' population='100000'>This is some text" + "</location>" + "<person>" + " <name>Bill</name>" + "</person>" + "</ignored>|))"); final Identifier il = agent.getInputOutput().getInputLink(); final MatcherBuilder m = Wmes.matcher(agent); final Identifier xml = m.attr("xml").find(il).getValue().asIdentifier(); assertNotNull(xml); final Wme location = m.attr("location").find(xml); assertNotNull(location); final Wme locAttrs = m.attr(DefaultWmeToXml.ATTRS).find(location); assertNotNull(locAttrs); assertEquals("Ann Arbor", m.attr("name").find(locAttrs).getValue().asString().getValue()); assertEquals("100000", m.attr("population").find(locAttrs).getValue().asString().getValue()); assertEquals("This is some text", m.attr(DefaultWmeToXml.TEXT).find(location).getValue().asString().getValue()); final Wme person = m.attr("person").find(xml); assertNotNull(person); assertSame(person.getValue(), m.attr(DefaultWmeToXml.NEXT).find(location).getValue()); final Wme name = m.attr("name").find(person); assertEquals("Bill", m.attr(DefaultWmeToXml.TEXT).find(name).getValue().asString().getValue()); }
public Identifier fromXml(Element element) { return fromXmlInternal(element); }
DefaultXmlToWme implements XmlToWme { public Identifier fromXml(Element element) { return fromXmlInternal(element); } }
DefaultXmlToWme implements XmlToWme { public Identifier fromXml(Element element) { return fromXmlInternal(element); } DefaultXmlToWme(WmeFactory<?> wmeFactory); }
DefaultXmlToWme implements XmlToWme { public Identifier fromXml(Element element) { return fromXmlInternal(element); } DefaultXmlToWme(WmeFactory<?> wmeFactory); static DefaultXmlToWme forInput(InputOutput io); static DefaultXmlToWme forRhsFunction(RhsFunctionContext rhsContext); Identifier fromXml(Element element); }
DefaultXmlToWme implements XmlToWme { public Identifier fromXml(Element element) { return fromXmlInternal(element); } DefaultXmlToWme(WmeFactory<?> wmeFactory); static DefaultXmlToWme forInput(InputOutput io); static DefaultXmlToWme forRhsFunction(RhsFunctionContext rhsContext); Identifier fromXml(Element element);  }