I need help with displaying content from this XML block:
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>We are excited to announce that the <a href="https://world.phparch.com/call-for-speakers/">Call for Speakers</a> has opened for <a href="https://world.phparch.com">php[world] 2016</a>.
</p>
<p>Now in its 3rd year, <a href="https://world.phparch.com">php[world]</a> is the conference designed to bring the entire world of PHP together in one place, with dedicated tracks for the biggest applications and frameworks in the PHP community such as WordPress, Drupal, Magento, Joomla!, Symfony, Zend Framework, CakePHP, and Laravel.
</p>
<p>We need to hear from you what you want to speak about though. Talks that fit any of those frameworks or are related to PHP development are all welcome. We offer a comprehensive speakers package to make sure that our presenters aren't put out financially for the event, including:
</p>
<ul>
<li>Airfare coverage ($400 domestic, $1000 international)</li>
<li>Hotel room (1 night + 1 per accepted talk)</li>
<li>Free ticket to the conference</li>
<li>Most meals included!</li>
</ul>
<p>Don't hesitate, our <a href="https://world.phparch.com/call-for-speakers/">Call for Speakers</a> is only open for 3 weeks and closes on June 24th, 2016. So get those submissions in soon, we look forward to <a href="https://world.phparch.com/call-for-speakers/">hearing from you</a>!</p>
</div>
I can' t display a element inside p XML element, thanks for help.
答案 0 :(得分:0)
虽然root div的所有子节点都没有前缀,但它们位于命名空间中,该命名空间指定了它的属性。因此,您无法以通常的方式引用它们
使用DomDocument代码可能是:
$xml = simplexml_load_string($string);
$xml->registerXPathNamespace('o', "http://www.w3.org/1999/xhtml");
foreach($xml->xpath('//o:p/o:a') as $a)
echo $a . "\n";
GeoFire query on User location
或使用SimpleXML:
public class Joystick : MonoBehaviour, IPointerDownHandler, IPointerUpHandler, IDragHandler
{
public enum AxisOption
{
// Options for which axes to use
Both, // Use both
OnlyHorizontal, // Only horizontal
OnlyVertical // Only vertical
}
public int MovementRange = 100;
public AxisOption axesToUse = AxisOption.Both; // The options for the axes that the still will use
public string horizontalAxisName = "Horizontal"; // The name given to the horizontal axis for the cross platform input
public string verticalAxisName = "Vertical"; // The name given to the vertical axis for the cross platform input
Vector3 m_StartPos;
bool m_UseX; // Toggle for using the x axis
bool m_UseY; // Toggle for using the Y axis
CrossPlatformInputManager.VirtualAxis m_HorizontalVirtualAxis; // Reference to the joystick in the cross platform input
CrossPlatformInputManager.VirtualAxis m_VerticalVirtualAxis; // Reference to the joystick in the cross platform input
void OnEnable()
{
CreateVirtualAxes();
}
void Start()
{
m_StartPos = transform.position;
}
void UpdateVirtualAxes(Vector3 value)
{
var delta = m_StartPos - value;
delta.y = -delta.y;
delta /= MovementRange;
if (m_UseX)
{
m_HorizontalVirtualAxis.Update(-delta.x);
}
if (m_UseY)
{
m_VerticalVirtualAxis.Update(delta.y);
}
}
void CreateVirtualAxes()
{
// set axes to use
m_UseX = (axesToUse == AxisOption.Both || axesToUse == AxisOption.OnlyHorizontal);
m_UseY = (axesToUse == AxisOption.Both || axesToUse == AxisOption.OnlyVertical);
// create new axes based on axes to use
if (m_UseX)
{
m_HorizontalVirtualAxis = new CrossPlatformInputManager.VirtualAxis(horizontalAxisName);
CrossPlatformInputManager.RegisterVirtualAxis(m_HorizontalVirtualAxis);
}
if (m_UseY)
{
m_VerticalVirtualAxis = new CrossPlatformInputManager.VirtualAxis(verticalAxisName);
CrossPlatformInputManager.RegisterVirtualAxis(m_VerticalVirtualAxis);
}
}
public void OnDrag(PointerEventData data)
{
Vector3 newPos = Vector3.zero;
if (m_UseX)
{
int delta = (int)(data.position.x - m_StartPos.x);
newPos.x = delta;
}
if (m_UseY)
{
int delta = (int)(data.position.y - m_StartPos.y);
newPos.y = delta;
}
var newPosition = new Vector3(newPos.x, newPos.y, newPos.z);
transform.position = Vector3.ClampMagnitude(newPosition, MovementRange) + m_StartPos;
UpdateVirtualAxes(transform.position);
}
public void OnPointerUp(PointerEventData data)
{
transform.position = m_StartPos;
UpdateVirtualAxes(m_StartPos);
}
public void OnPointerDown(PointerEventData data) { }
}